package com.borko.healthcare.persistence.hibernate.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.borko.healthcare.entities.beans.SupplierBean;
import com.borko.healthcare.entities.interfaces.Supplier;


public class SupplierDAOImpl extends HibernateDaoSupport implements SupplierDAO {
	
	private void createOrUpdate(Supplier suppiler) {
		getHibernateTemplate().saveOrUpdate(suppiler);
	}

	public void create(Supplier suppiler) {
		createOrUpdate(suppiler);
	}

	public void delete(Supplier suppiler) {
		getHibernateTemplate().delete(suppiler);
	}

	public List<Supplier> retrive() {
		return getHibernateTemplate().loadAll(Supplier.class);
	}

	public void update(Supplier suppiler) {
		getHibernateTemplate().saveOrUpdate(suppiler);
	}
	
	public Supplier getSupplier(int id) {
		return getHibernateTemplate().get(SupplierBean.class, id);
	}

}
